﻿package app.view.components.sections.expo 
{
	import app.model.types.SectionType;
	import app.model.vo.SectionVO;
	import app.view.components.buttons.GlamurBtnBase;
	import app.view.components.header.HeadMarkerBase;
	import app.view.components.sections.LabeledSectionBase;
	import app.view.events.UIEvent;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	/**
	 * 1.1.1 КОНЦЕПЦИЯ УЧАСТИЯ
	 * @author Dmitryi_Koruagin, icq:585466579, dmitryikoruagin@mail.ru, skype: ok_ru1
	 */
	public class ExpoConceptDBase extends LabeledSectionBase 
	{
		//app.view.components.sections.expo.ExpoConceptDBase
		public var arhitectyra_Btn:GlamurBtnBase;
		public var scenographia_Btn:GlamurBtnBase;
		public var text:TextField;
		
		
		public function ExpoConceptDBase() 
		{
			super();
		}
		
		override protected function init():void
		{
			super.init();
			
			text.wordWrap = true;
			text.multiline = true;
			
		}
		
		private function setEvents():void
		{
			arhitectyra_Btn.addEventListener(MouseEvent.CLICK, onClickArhitecturaBtn);
			scenographia_Btn.addEventListener(MouseEvent.CLICK, onScenografiaBtn);
		}
		
		
		private function removeEvents():void
		{
			arhitectyra_Btn.removeEventListener(MouseEvent.CLICK, onClickArhitecturaBtn);
			scenographia_Btn.removeEventListener(MouseEvent.CLICK, onScenografiaBtn);
		}
		
		override public function onDestroy():void 
		{
			// чистим что тут есть и вызываем супера
			removeEvents();
			
			arhitectyra_Btn.destroy();
			scenographia_Btn.destroy();
			
			super.onDestroy();
		};
		
		override public function get data():Object { return _data; };
		
		override public function set data(value:Object):void 
		{
			super.data = value;
			
			arhitectyra_Btn.setLang(_data.lang);
			scenographia_Btn.setLang(_data.lang);
			
			setParamHead(HeadMarkerBase.BGD_RED);
			
			////trace('data!!!',_data.data);
			
			setEvents();
		};
		
		/**
		 * переход на Архитектуру
		 * @param	e
		 */
		private function onClickArhitecturaBtn(e:MouseEvent):void 
		{
			removeEvents();
			
			var obj:SectionVO = new SectionVO();
			obj.id = SectionType.PAGE_EXPO_CONCEPT_ARHITECTURE;
			obj.currentId = id;
			obj.params = null;
			
			var ev:UIEvent = new UIEvent(UIEvent.SECTION_CHANGE);
			ev.data = obj;
			dispatchEvent(ev);
		}
		
		/**
		 * переход на сценографию
		 * @param	e
		 */
		private function onScenografiaBtn(e:MouseEvent):void 
		{
			removeEvents();
			
			var obj:SectionVO = new SectionVO();
			obj.id = SectionType.PAGE_EXPO_CONCEPT_SCENOGRAPHIA;
			obj.currentId = id;
			obj.params = null;
			
			var ev:UIEvent = new UIEvent(UIEvent.SECTION_CHANGE);
			ev.data = obj;
			dispatchEvent(ev);
		}
	}

}